#ifndef COLOR_H
#define COLOR_H

#include <windows.h>

CONSOLE_SCREEN_BUFFER_INFO coninfo; //holds screen info
HANDLE hconsole;

void initgraphics()
{
	// Grabs the console so we can manipulate it.
	hconsole = CreateFile("CONOUT$", GENERIC_WRITE | GENERIC_READ,
				FILE_SHARE_READ | FILE_SHARE_WRITE,
				0L, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0L);

	GetConsoleScreenBufferInfo(hconsole, &coninfo);
}

void setcolor(int fcolor, int bcolor = 0)
{
	// Grabs the Console's Text Attributes, WORD is a short(16bit), moves bcolor 4 bits to the right and stores fcolor in the first 4 bits
	SetConsoleTextAttribute(hconsole, (WORD)((bcolor << 4) | fcolor));
}
#endif